<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('添加订单')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-profitSbOrder-batchBill">
            <input type="hidden" name="ableIds" th:value="${ableIds}" />
            <input type="hidden" name="ableSize" th:value="${ableSize}" />
            <fieldset style="margin:0px 0px 3px 0px;height:62px;">
                <legend>选中被添入单的信息</legend>
                <span style="color: red;" th:text="${'总条数：'+ableSize+' 条'}"></span>
                <span style="color: red;margin-left:30px;" th:text="${'总应出款：'+money+' 元'}"></span>
            </fieldset>
            <fieldset style="margin-top: 20px">
                <legend>当前订单信息：</legend>
                <div class="form-group">
                    <label class="col-sm-3 control-label">订单编号：</label>
                    <div class="col-sm-8">
                        <input name="ordernumber" th:value="${orderMap.ORDERNUMBER}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">出款人：</label>
                    <div class="col-sm-8">
                        <input th:value="${orderMap['PAYMONEY_PERSON']}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">审核人：</label>
                    <div class="col-sm-8">
                        <input  th:value="${orderMap['CHECK_PERSON']}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">出款笔数：</label>
                    <div class="col-sm-8">
                        <input name="sumcount" th:value="${orderMap.SUMCOUNT}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">总商户数：</label>
                    <div class="col-sm-8">
                        <input name="sumtrade" th:value="${orderMap.SUMTRADE}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">出款金额：</label>
                    <div class="col-sm-8">
                        <input name="openMoney" th:value="${orderMap.PAY_MONEY}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">刷卡金额：</label>
                    <div class="col-sm-8">
                        <input name="sumamount" th:value="${orderMap.SUMAMOUNT}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">出款方式：</label>
                    <div class="col-sm-8">
                        <input  value="代付" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">建单类型：</label>
                    <div class="col-sm-8">
                        <input  value="代付" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">制单日期：</label>
                    <div class="col-sm-8">
                        <input th:value="${orderMap.INDATE}" class="form-control" type="text" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">制单人：</label>
                    <div class="col-sm-8">
                        <input th:value="${orderMap.ADD_BILLS_PERSON}" class="form-control" type="text" readonly>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "agentInfo/profitSbOrder";
        $("#form-profitSbOrder-batchBill").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                //$.operate.save(prefix + "/batchBill", $('#form-profitSbOrder-batchBill').serialize());
                var formData = new FormData();
                var ableIds=$("[name='ableIds']").val();
                formData.append("ableIds",ableIds);

                var ableSize=$("[name='ableSize']").val();
                formData.append("ableSize",ableSize);

                var ordernumber=$("[name='ordernumber']").val();
                formData.append("ordernumber",ordernumber);
                $.ajax({
                    url : prefix + "/batchBill",
                    type: 'POST',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    beforeSend: function () {
                        $.modal.loading("正在处理中，请稍后...");
                        $.modal.disable();
                    },
                    success : function(result) {
                        if (result.code == web_status.SUCCESS) {
                            var parent = window.parent;
                            if (parent.table.options.type == table_type.bootstrapTable) {
                                $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
                            } else if (parent.table.options.type == table_type.bootstrapTreeTable) {
                                $.modal.close();
                                parent.$.modal.msgSuccess(result.msg);
                                parent.$.treeTable.refresh();
                            } else {
                                $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
                            }
                        } else if (result.code == web_status.WARNING) {
                            $.modal.alertWarning(result.msg)
                        }  else {
                            $.modal.alertError(result.msg);
                        }
                        $.modal.closeLoading();
                        $.modal.enable();
                    },
                    error : function(result) {
                        $.modal.alertError(result.msg);
                    }
                });
            }
        }
    </script>
</body>
</html>